<?php
/**
 * Created by PhpStorm.
 * User: lx
 * Date: 2020/1/14
 * Time: 15:15
 */
namespace app\api\controller;

use app\api\model\MtUserVip;
use app\api\model\MtVipClass;
use app\util\ReturnCode;

class Vip extends Base
{
    public function __construct(){
        parent::__construct();
    }
    public function openVip(){
        $userID = $this->request->param("userID");
        $start = time();
        $end = strtotime("+1 year");

    }

    /**
     * 会员卡类型获取
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getVipClass(){
        $obj = new MtVipClass();
        $resData = $obj->where("status","1")->select();
        if(!$resData){
            return $this->error(ReturnCode::DB_READ_ERROR,"查询失败");
        }
        return $this->success("查询成功",$resData);
    }

    /**
     * 会员卡页面滚动条
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getVipList(){
        $obj = new MtUserVip();
        $resData = $obj->where("status","1")->order("cTime asc")->limit(3)->select();
        if(!$resData){
            return $this->error(ReturnCode::DB_READ_ERROR,"查询失败");
        }
        return $this->success("查询成功",$resData);
    }
}